import java.sql.SQLOutput;
import java.util.Scanner;

public class Gun {

    MyStack magazine = new MyStack();
    //射击
    public void shoot() throws InterruptedException {
        magazine.pop();
        System.out.println("射出一颗子弹");
        System.out.println("正在自动上膛下一颗子弹");
        Thread.sleep(1000);
        System.out.println("已上膛");
    }
    //装弹
    public void load() throws InterruptedException {
        while(magazine.getUseSize() < 3) {
            magazine.push(1);
            System.out.println("装填子弹中");
            Thread.sleep(1000);
        }
        System.out.println("装填完毕");
    }
}
